#ifndef COMPONENT_H
#define COMPONENT_H

#include "ComponentManager.h"

#include "ComponentArguments.h"
#include "PropertyManager.h"

#include <string>

#include "../lib/tinyXML/tinyxml.h"




class ComponentManager;


class Component
{

    friend class ComponentManager;

    public:


        virtual void initialize() = 0;
        virtual void destroy() = 0;

        virtual void saveToXML(TiXmlElement* parentElement)=0;
        virtual void loadFromXML(TiXmlElement* parentElement)=0;

        virtual void update(double timeSinceLastFrame)=0;
        virtual void registerNewComponent(std::string _newComponentName)=0;


        template <class T> void addProperty(std::string _name, T _value){((PropertyManager*)m_parent)->addProperty(_name, _value);};
        template <class T> void removeProperty(std::string _name){((PropertyManager*)m_parent)->removeProperty(_name);};

        template <class T> void setPropertyValue(std::string _name, T _value){((PropertyManager*)m_parent)->setPropertyValue<T>(_name, _value);};
        template <class T> T getPropertyValue(std::string _name){return ((PropertyManager*)m_parent)->getPropertyValue<T>(_name);};

    protected:

        Component(ComponentManager* _parent, ComponentArguments _args);
        virtual ~Component();

         ComponentManager* m_parent;

    private:



};

#endif // COMPONENT_H
